package com.gg.fmallspringboot.controller;

import com.gg.fmallspringboot.entity.ShoppingCart;
import com.gg.fmallspringboot.model.Result;
import com.gg.fmallspringboot.service.CarService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 购物车controller
 */

@RestController
@RequestMapping("/car")
public class CarController {

    private CarService carService;

    public CarController(CarService carService) {
        this.carService = carService;
    }

    @GetMapping
    public List<ShoppingCart> getCarList(){
        return carService.carList();
    }

    @GetMapping("/orderCart")
    public Result getOrderCart(String carIds,Integer userId){
    return carService.getOrderCar(carIds,userId);
    }

}
